package com.graduate.examapp.request

import com.graduate.examapp.entity.*
import okhttp3.MultipartBody
import okhttp3.ResponseBody
import retrofit2.http.*


/**
 * Author: etacao
 * Date: 2023/4/13 11:40
 * Description:
 * History:
 * <author> <time> <version> <desc>
 * etacao 2023/4/13 1.0 首次创建
 */
interface ServiceEndpoint {
    @POST("/user/login")
    suspend fun login(@Body loginParam: LoginParam): Response<LoginData>

    @GET("/examtask/fetch_assist_task")
    suspend fun fetchAssitTask(@Query("assistantId") assistantId: String): Response<List<ExamTask>>

    @GET("/examtask/fetch_task")
    suspend fun fetchInvigilateTask(@Query("invigilatorId") invigilatorId: String): Response<List<ExamTask>>

    @GET("/examtask/fetchall")
    suspend fun fetchHistoryData(@Query("insName") insName: String): Response<List<HistoryData>>

    @GET("/user/fetch_teachers")
    suspend fun fetchTeachers(@Query("insName") insName: String): Response<MutableList<Teacher>>

    @POST("/user/delteacher")
    suspend fun delTeacher(@Body teacherDelParam: StatusParam): Response<Boolean>

    @POST("/exam/range")
    suspend fun rangeExam(@Body examRangeParam: ExamRangeParam): Response<ExamTask>

    @GET("/examtask/fetch_alltask")
    suspend fun fetchAllExam(@Query("insName") insName: String): Response<MutableList<ExamTask>>

    @GET("/exam/firstday")
    suspend fun setFrstDay(@Query("firstDay") firstDay: String): Response<Boolean>

    @GET("/examtask/cancel")
    suspend fun cancelExam(@Query("id") id: Int): Response<Boolean>

    @POST("/user/statuschange")
    suspend fun changeStatus(@Body statusParam: StatusParam): Response<Boolean>

    @POST("/user/addteacher")
    suspend fun addTeacher(@Body addUserParam: AddUserParam): Response<Boolean>

    @GET("/user/logout")
    suspend fun logout(): Response<Boolean>

    @Multipart
    @POST("/user/upload")
    suspend fun uploadOneFile(@Part file: MultipartBody.Part): Response<Boolean>
}